#pragma once

#include "StlStringAndStreams.h"

namespace Utilities
{

inline int StringToInt(const STL::string& i_string)
{
	int number = 0;
	int exp = 1;
	for (int i = i_string.length() - 1 ; i >= 0 ; --i)
	{

		if (i_string[i] < '0' || i_string[i] > '9')
			return -1;
		number += (i_string[i] - '0') * exp;
		exp *= 10;
	}
	return number;
}

inline const char* const IntToString(const int i_int)
{
	static char intStr[16];
	sprintf_s(intStr, "%d", i_int);
	return intStr;
}

inline const char* const RatioToString(const float i_ratio)
{
	if(i_ratio < 0.0f)
		return "----";
	static char ratioStr[8];
	sprintf_s(ratioStr, "%4.2f",i_ratio);
	return ratioStr;
}

inline const STL::string IntToStlString(const int i_int)
{
	return IntToString(i_int);
}

inline const STL::string& TabUpTo(const STL::string& i_string, const unsigned int i_tabLenght)
{
	static STL::string ret;

	ret = i_string;
	ret.resize(i_tabLenght,' ');
	return ret;
}

inline const STL::string& TabUpTo(const int i_val, const unsigned int i_tabLenght)
{
	return TabUpTo(IntToString(i_val), i_tabLenght);
}

} // namespace Utilities
